<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>My Project: drogon::RateLimiter类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">My Project
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacedrogon.html">drogon</a></li><li class="navelem"><a class="el" href="classdrogon_1_1RateLimiter.html">RateLimiter</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pub-static-methods">静态 Public 成员函数</a> &#124;
<a href="classdrogon_1_1RateLimiter-members.html">所有成员列表</a>  </div>
  <div class="headertitle"><div class="title">drogon::RateLimiter类 参考<span class="mlabels"><span class="mlabel">abstract</span></span></div></div>
</div><!--header-->
<div class="contents">

<p>This class is used to limit the number of requests per second  
 <a href="classdrogon_1_1RateLimiter.html#details">更多...</a></p>

<p><code>#include &lt;<a class="el" href="RateLimiter_8h_source.html">RateLimiter.h</a>&gt;</code></p>
<div class="dynheader">
类 drogon::RateLimiter 继承关系图:</div>
<div class="dyncontent">
<div class="center"><img src="classdrogon_1_1RateLimiter__inherit__graph.png" border="0" usemap="#adrogon_1_1RateLimiter_inherit__map" alt="Inheritance graph"/></div>
<map name="adrogon_1_1RateLimiter_inherit__map" id="adrogon_1_1RateLimiter_inherit__map">
<area shape="rect" title="This class is used to limit the number of requests per second" alt="" coords="20,5,171,31"/>
<area shape="rect" href="classdrogon_1_1SafeRateLimiter.html" title=" " alt="" coords="5,79,185,104"/>
<area shape="poly" title=" " alt="" coords="98,44,98,79,93,79,93,44"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">图例</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:ade4b358a0031fe9fc38c96520683e7a8" id="r_ade4b358a0031fe9fc38c96520683e7a8"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1RateLimiter.html#ade4b358a0031fe9fc38c96520683e7a8">isAllowed</a> ()=0</td></tr>
<tr class="memdesc:ade4b358a0031fe9fc38c96520683e7a8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if a request is allowed  <br /></td></tr>
<tr class="separator:ade4b358a0031fe9fc38c96520683e7a8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0b215093286124679cf442eeae189682" id="r_a0b215093286124679cf442eeae189682"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1RateLimiter.html#a0b215093286124679cf442eeae189682">~RateLimiter</a> () noexcept=default</td></tr>
<tr class="separator:a0b215093286124679cf442eeae189682"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-methods" name="pub-static-methods"></a>
静态 Public 成员函数</h2></td></tr>
<tr class="memitem:a82c37ef918c9116b29b843a4ee26a84c" id="r_a82c37ef918c9116b29b843a4ee26a84c"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="namespacedrogon.html#a4c0f7a484aae57628970bf55f539ab5d">RateLimiterPtr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1RateLimiter.html#a82c37ef918c9116b29b843a4ee26a84c">newRateLimiter</a> (RateLimiterType type, size_t capacity, std::chrono::duration&lt; double &gt; timeUnit=std::chrono::seconds(60))</td></tr>
<tr class="memdesc:a82c37ef918c9116b29b843a4ee26a84c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a rate limiter  <br /></td></tr>
<tr class="separator:a82c37ef918c9116b29b843a4ee26a84c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>This class is used to limit the number of requests per second </p>
</div><h2 class="groupheader">构造及析构函数说明</h2>
<a id="a0b215093286124679cf442eeae189682" name="a0b215093286124679cf442eeae189682"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0b215093286124679cf442eeae189682">&#9670;&#160;</a></span>~RateLimiter()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual drogon::RateLimiter::~RateLimiter </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span><span class="mlabel">default</span><span class="mlabel">noexcept</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">成员函数说明</h2>
<a id="ade4b358a0031fe9fc38c96520683e7a8" name="ade4b358a0031fe9fc38c96520683e7a8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ade4b358a0031fe9fc38c96520683e7a8">&#9670;&#160;</a></span>isAllowed()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool drogon::RateLimiter::isAllowed </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Check if a request is allowed </p>
<dl class="section return"><dt>返回</dt><dd>true The request is allowed </dd>
<dd>
false The request is not allowed </dd></dl>

<p>在 <a class="el" href="classdrogon_1_1SafeRateLimiter.html#a7418bc585c3c049285fb5b830b9a791c">drogon::SafeRateLimiter</a> 内被实现.</p>

</div>
</div>
<a id="a82c37ef918c9116b29b843a4ee26a84c" name="a82c37ef918c9116b29b843a4ee26a84c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a82c37ef918c9116b29b843a4ee26a84c">&#9670;&#160;</a></span>newRateLimiter()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="namespacedrogon.html#a4c0f7a484aae57628970bf55f539ab5d">RateLimiterPtr</a> drogon::RateLimiter::newRateLimiter </td>
          <td>(</td>
          <td class="paramtype">RateLimiterType&#160;</td>
          <td class="paramname"><em>type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>capacity</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::chrono::duration&lt; double &gt;&#160;</td>
          <td class="paramname"><em>timeUnit</em> = <code>std::chrono::seconds(60)</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Create a rate limiter </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">type</td><td>The type of the rate limiter </td></tr>
    <tr><td class="paramname">capacity</td><td>The maximum number of requests in the time unit. </td></tr>
    <tr><td class="paramname">timeUnit</td><td>The time unit of the rate limiter. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>A rate limiter pointer </dd></dl>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li><a class="el" href="RateLimiter_8h_source.html">RateLimiter.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
</small></address>
</body>
</html>
